home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
PC Answers 2002 January
/
PC Answers January 2002.7z
/
PC Answers January 2002.bin
/
graphics
/
freepixl
/
_SETUP.1
/
Legend.pxl
< prev
next >
Wrap
Text File
|
2000-12-23
|
6KB
|
222 lines
Initialize:
UseCoordinates(PIXEL)
SetColorPalette(BITMAP)
Title$ = "PiXCL Image Display with Legends"
UseCaption(Title$)
WinLocate(Title$,100,100,880,610,Res)
WinShow(Title$,TOPMOST,Res)
ImageFile$ = ""
UseBackground(TRANSPARENT,192,192,192)
DrawBackground
DirGet(SourceDir$)
Image1$ = SourceDir$ + "\brsfbnd1.bmp"
Image2$ = SourceDir$ + "\brsfbnd2.bmp"
Image3$ = SourceDir$ + "\brsfbnd3.bmp"
Image4$ = SourceDir$ + "\brsfbnd4.bmp"
Image5$ = SourceDir$ + "\brsfbnd5.bmp"
Image7$ = SourceDir$ + "\brsfbnd7.bmp"
Image8$ = SourceDir$ + "\brsfc754.bmp"
Image9$ = SourceDir$ + "\brstclas.bmp"
Image10$ = SourceDir$ + "\brstgrid.bmp"
UseFont("MS Sans Serif",0,19,NOBOLD,NOITALIC,NOUNDERLINE,255,0,0)
InitFile$ = "*.bmp"
InfoMenu(REMOVE)
WaitInput(100)
SetMenu("&File",IGNORE,
"Exit!",Leave,
ENDPOPUP,
"Image Info",IGNORE,
"GetBitMapInfo",GetImageInfo,
"Reload",ReloadImage,
"Class Overlays",OverlayThemes,
"Grid Overlays",OverlayGrids,
"Create Legend",CreateLegend,
"Adjust Legend",AdjustLegend,
"Interactive Legend",InteractiveLegend,
ENDPOPUP)
StatusWindow(ENABLE,BOTTOM,4,290,390,490,-1)
Filter$ = "BMP files(*.bmp),*.bmp,JPG files(*.jpg),*.jpg,"
Filter$ = Filter$ + "PNG files(*.png),*.png,PCX files(*.pcx),*.pcx,"
Filter$ = Filter$ + "PSD files(*.psd),*.psd,RAS files(*.ras),*.ras,"
Filter$ = Filter$ + "TGA files(*.tga),*.tga,TIF files(*.tif),*.tif"
Wait_for_Input:
WaitInput()
Leave:
End
CountTheList:
Chr(13,CR$)
ListLoadedBitmaps(List$,CR$,Count)
Str(Count,Count$)
Msg$ = "Entries in PiXCL Bitmap List = " + Count$
MessageBox(OK,1,INFORMATION,List$,Msg$,Res)
Goto Wait_for_Input
GetImageInfo:
DrawBackGround
SetMouse()
SetRightMouse()
If ImageFile$ <> "" Then FreeBitMap(ImageFile$)
FileGet(Filter$, InitFile$, "",
"Test of PXLimage v4.2 DLL",CHANGEDIR,ImageFile$)
If ImageFile$ = "" Then Goto Wait_for_Input
FileExtension(ImageFile$,Ext$,Res)
InitFile$ = "*." + Ext$
Ext$ = Ext$ + " Image File Format Read"
GetBitMapDim(ImageFile$,Lines,Pixels,Bits)
DrawBackGround
{ DrawText(25,0,Ext$)
DrawText(560,30,"Lines") DrawNumber(660,30,Lines)
DrawText(560,50,"Pixels") DrawNumber(660,50,Pixels)
DrawText(560,70,"Bits") DrawNumber(660,70,Bits)
}
If Bits <> 0
sx1 = 20 sy1 = 20
sx2 = 26 + Pixels sy2 = 26 + Lines
DrawEdgeRectangle(sx1,sy1,sx2,sy2,SUNKENEDGE,ADJUST,RECT)
DrawBitMap(23,23,ImageFile$)
Endif
Goto Wait_for_Input
ReloadImage:
FreeBitmap(ImageFile$)
DrawBitMap(23,23,ImageFile$)
Goto Wait_for_Input
OverlayThemes:
If ImageFile$ = "" Then Beep Goto Wait_for_Input
LoadBitmap(Image9$,FULL)
DrawBitMap(23,23,ImageFile$)
OverlayImage(Image9$, 0,0,0, Res)
GetBitMapDim(ImageFile$,Lines,Pixels,Bits)
DrawBitMap(23,23,ImageFile$)
Goto Wait_for_Input
OverlayGrids:
If ImageFile$ = "" Then Beep Goto Wait_for_Input
WaitInput(1)
LoadBitmap(Image10$,FULL)
DrawBitmap(23,23,ImageFile$)
OverlayImage(Image10$, 255,255,255, Res)
If Res = 0
MessageBox(OK,1,INFORMATION,"Overlay failed","DEBUG",Res)
Endif
GetBitMapDim(ImageFile$,Lines,Pixels,Bits)
DrawBitmap(23,23,ImageFile$)
Goto Wait_for_Input
CreateLegend:
WinGetClientRect("",cx1,cy1,cx2,cy2)
Lx1 = sx2 + 10 Ly1 = sy1
Lx2 = LX1 + 20 Ly2 = Ly1 + 23 Ly3 = Ly2 + 9
Tx2 = cx2 - 5
UsePen(SOLID,1,0,0,0)
UseBrush(SOLID,255,0,0)
UseFont("Arial",7,13,NOBOLD,NOITALIC,NOUNDERLINE,0,0,0)
DrawRectangle(Lx1,Ly1,Lx2,Ly2)
Tx1 = Lx2 + 5
DrawTextExt(Tx1,Ly1,Tx2,Ly3,"Theme #1: wetland regions, medium moisture levels.",LEFT)
Ly1 = Ly2 + 15
Ly2 = Ly1 + 23
Ly3 = Ly2 + 9
UseBrush(SOLID,0,255,0)
DrawRectangle(Lx1,Ly1,Lx2,Ly2)
Tx1 = Lx2 + 5
DrawTextExt(Tx1,Ly1,Tx2,Ly3,"Theme #2: bare rock surfaces",LEFT)
Ly1 = Ly2 + 15
Ly2 = Ly1 + 23
Ly3 = Ly2 +9
UseBrush(SOLID,0,0,255)
DrawRectangle(Lx1,Ly1,Lx2,Ly2)
Tx1 = Lx2 + 5
DrawTextExt(Tx1,Ly1,Tx2,Ly3,"Theme #3: mountainous regions with vegetation, moderate moisture levels",LEFT)
Ly1 = Ly2 + 15
Ly2 = Ly1 + 23
Ly3 = Ly2 + 9
UseBrush(SOLID,255,255,0)
DrawRectangle(Lx1,Ly1,Lx2,Ly2)
Tx1 = Lx2 + 5
DrawTextExt(Tx1,Ly1,Tx2,Ly3,"Theme #4: low relief fractured rock surfaces.",LEFT)
Ly1 = Ly2 + 15
Ly2 = Ly1 + 23
Ly3 = Ly2 + 9
UseBrush(SOLID,255,0,255)
DrawRectangle(Lx1,Ly1,Lx2,Ly2)
Tx1 = Lx2 + 5
DrawTextExt(Tx1,Ly1,Tx2,Ly3,"Theme #5: swamp and wetland regions, high moisture levels.",LEFT)
Ly1 = Ly2 + 15
Ly2 = Ly1 + 23
Ly3 = Ly2 + 9
UseBrush(SOLID,0,255,255)
DrawRectangle(Lx1,Ly1,Lx2,Ly2)
Tx1 = Lx2 + 5
DrawTextExt(Tx1,Ly1,Tx2,Ly3,"Theme #6: highly reflective river sand regions, low moisture levels. ",LEFT)
Goto Wait_for_Input
AdjustLegend:
WinGetClientRect("",cx1,cy1,cx2,cy2)
SetMouse(cx1,cy1,cx2,cy2,Select_1,x,y)
WaitInput()
Select_1:
SetMouse()
Pattern7$ = SourceDir$ + "\pattern7.jpg"
px1 = x - 3 py1 = y - 3
px2 = x + 13 py2 = y + 13
SaveRectangle(px1,py1,px2,py2,Pattern7$,Res)
WaitInput(500)
SetMouse(Lx1,Ly1,Lx2,Ly2,Select_2,x,y)
WaitInput()
Select_2:
SetMouse()
FreeBitmap(Pattern7$)
UseBrushPattern(Pattern7$)
DrawFloodExt(x,y,0,0,0,BORDER)
Goto Wait_for_Input
InteractiveLegend:
WinGetClientRect("",cx1,cy1,cx2,cy2)
SetMouse(cx1,cy1,cx2,cy2,Select_3,x,y)
WaitInput()
Select_3:
SetMouse()
Pattern7$ = SourceDir$ + "\pattern7.jpg"
px1 = x - 3 py1 = y - 3
px2 = x + 13 py2 = y + 13
SaveRectangle(px1,py1,px2,py2,Pattern7$,Res)
WaitInput(500) {let Windows catch up, flush the buffers}
Text$ = "Enter the description of this region"
Label$ = "Interactive Legend Generation"
Legend$ = ""
TextBox(Text$,Label$,Legend$,Btn)
If Btn = 2 Then Goto Wait_for_Input
Ly1 = Ly2 + 15
Ly2 = Ly1 + 23
Ly3 = Ly2 + 9
FreeBitmap(Pattern7$)
UseBrushPattern(Pattern7$)
DrawRectangle(Lx1,Ly1,Lx2,Ly2)
Tx1 = Lx2 + 5
DrawTextExt(Tx1,Ly1,Tx2,Ly3,Legend$,LEFT)
Goto Wait_for_Input